<?php

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Menu;
use DB;
class indexController extends Controller
{
    public function index(Request $request){

        //获取用户可访问的菜单
        $menu_ids=$request->session()->get('menu_ids');
        $menu_ids=explode(',',$menu_ids);
        //用可访问的菜单搜索
        $menus=Menu::whereIn('id',$menu_ids)->where('is_nav',1)->orderByDesc('sort')->orderByDesc('updated_at')->get();
        return view('admin.index',compact('menus'));
    }
}
